//-----------------------------------------------------------------------
//<copyright file="SanPhamBLL.cs
//Code gen by tool.
//</copyright>
//-----------------------------------------------------------------------
using System;
using PMS.Exceptions;
using System.Collections.Generic;
using PMS.DAL;
using PMS.Entity;

namespace PMS.BLL
{
	public class SanPhamBO : BaseBO
	{
		// Interface Instant Object
		private readonly ISanPhamDAO sanphamInterfaceObject = null;

		// Constructor
		public SanPhamBO()
		{
			sanphamInterfaceObject = new DAL.ServiceFactory<ISanPhamDAO>().CurrentDAL;
		}

		#region SanPham

		/// <summary>
		///
		/// </summary>
		/// <param name="sanpham"></param>
		public SanPham CreateSanPham(SanPham sanpham)
		{
			try
			{
				return sanphamInterfaceObject.CreateSanPham(sanpham);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access CreateSanPham Exception", ex);
			}
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="sanpham"></param>
		public void UpdateSanPham(SanPham sanpham)
		{
			try
			{
				sanphamInterfaceObject.UpdateSanPham(sanpham);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access UpdateSanPhamException", ex);
			}
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="sanpham"></param>
		public void DeleteSanPham(SanPham sanpham)
		{
			try
			{
				sanphamInterfaceObject.DeleteSanPham(sanpham);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access DeleteSanPhamException", ex);
			}
		}

		/// <summary>
		///
		/// </summary>
		public SanPhams GetAllSanPham()
		{
			try
			{
				return sanphamInterfaceObject.GetAllSanPham();
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access GetAllSanPham Exception", ex);
			}
		}


        /// <summary>
        ///
        /// </summary>
        public SanPhams GetAllSanPhamCoNhapKho()
        {
            try
            {
                return sanphamInterfaceObject.GetAllSanPhamCoNhapKho();
            }
            catch (Exception ex)
            {
                throw BusinessException.GetException("Business Access GetAllSanPham Exception", ex);
            }
        }
		/// <summary>
		///
		/// </summary>
		/// <param name="maThuoc"></param>
		public SanPham GetSanPhamByID(string maThuoc)
		{
			try
			{
				return sanphamInterfaceObject.GetSanPhamByID(maThuoc);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access GetSanPhamBy ID Exception", ex);
			}
		}

		#endregion
	}
}
